﻿using RoadQualityEvaluatorData.Domain.Context;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace RoadQualityEvaluatorData.DomainServices.Generic
{
    public class UnitOfWork : IUnitOfWork
    {
        private RoadQualityDb_Context _context;

        public UnitOfWork()
        {
            this._context = new RoadQualityDb_Context();
        }

        

        public void Save()
        {
            this._context.SaveChanges();
        }


        private bool disposed = false;

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    _context.Dispose();
                }
            }
            this.disposed = true;
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }


        public RoadQualityDb_Context context
        {
            get { return this._context; }
        }
    }
}